package com.xxx.dao;

import com.xxx.pojo.Account;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @version v1.0
 * @Description:
 * @Author zhanzhongxin
 * @Date 2021/8/18 10:41
 * @Copyright 博为峰
 */
@Repository("accountDao")
public class AccountDaoImpl implements AccountDao {

    @Autowired
    private JdbcTemplate jdbcTemplate;

    @Override
    public int insetAccount(Account account) {
        return jdbcTemplate.update("insert into account(name,balance)values (?,?)", account.getName(), account.getBalance());
    }

    @Override
    public int delAccount(Integer id) {
        return 0;
    }

    @Override
    public int updateAccount(Account account) {
        return jdbcTemplate.update("update account set balance = ? where name = ?", account.getBalance(), account.getName());
    }

    @Override
    public List<Account> queryAccount() {
        return null;
    }
}
